<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="/page/share/taglib.jsp" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";

    path = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + request.getContextPath() + request.getServletPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath%>">

    <title>添加试卷</title>
    <link type="text/css" href="<%=basePath%>/css/base.css" rel="stylesheet"/>
    <link type="text/css" href="<%=basePath%>/css/downMenu.css" rel="stylesheet"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script type="text/javascript" src="../js/menu.js"></script>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript" src="<%=basePath%>/js/jquery.min.js"></script>
    <link href='<%=basePath%>/css/bootstrap-2.3.2.css' rel='stylesheet'>
    <script type="text/javascript" src="<%=basePath%>/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/jquery.pnotify.js"></script>
    <link href="<%=basePath%>/css/jquery.pnotify.default.css" rel="stylesheet">

    <script type="text/javascript" src="<%=basePath%>/js/ueditor.config2.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/ueditor.all.min.js"></script>
    <script type="text/javascript" src="<%=basePath%>/js/zh-cn.js"></script>
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/css/themes/icon.css">
    <%--dwr--%>
    <script src='<%=basePath%>dwr/util.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/engine.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/subjectService.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/testCategoryService.js' type="text/javascript"></script>
    <script src='<%=basePath%>dwr/interface/testService.js' type="text/javascript"></script>

    <%--dwr end--%>
    <script src='<%=basePath%>/js/addTestPaper.js' type="text/javascript"></script>


    <link href='<%=basePath%>/css/docs.css' rel='stylesheet'>
    <link href='<%=basePath%>/css/addTestPaper.css' rel='stylesheet'>

    <script type="text/javascript" src="<%=basePath%>/js/icheck.js"></script>


    <link href="<%=basePath%>/css/custom.css" rel="stylesheet">
    <link href="<%=basePath%>/css/square/_all.css" rel="stylesheet">

    <style type="text/css">
    </style>


    <script type="text/javascript">
        /*ajax获取题库*/
        function toPageTestList(subject, category, page) {
            selectedTest = 0;
            $("#selectedTestNum").html(selectedTest);
            tagManage(subject, category);
            var searchName = ["subject", "category"];
            var searchValue = [subject, category];
            testService.getTestList("${person.accout}", page, searchName, searchValue, getPageView);
        }

        /*跳转路径改变*/
        function changeHref(tab) {
            window.location.href = "<%=path%>" + $(tab).attr("href");
        }


    </script>

</head>

<body style="margin-top: 30px;">


<div class="container" style="margin-top: 30px;">
<div class="row">
<div class="col-md-3">

    <div class="bs-sidebar " role="complementary" data-spy="affix" id="myAffix">
        <ul class="nav bs-sidenav">
            <%--<li class="">
                <a href="#js-overview" onclick="changeHref(this);return false">概览<span class="badge badge-info">8</span>
                </a>
                <ul class="nav">
                    <li class=""><a href="#js-individual-compiled" onclick="changeHref(this);return false">单个还是全部引入</a>
                    </li>
                    <li><a href="#js-events" onclick="changeHref(this);return false">事件</a></li>
                </ul>
            </li>

            <li class="">
                <a href="#affix" onclick="changeHref(this);return false">Affix</a>
                <ul class="nav">
                    <li class=""><a href="#affix-examples" onclick="changeHref(this);return false">案例</a></li>
                </ul>
            </li>--%>

        </ul>
    </div>
</div>


<div class="col-md-9 " role="main">


<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header" style="margin-left: 80px;">
        <span class="navbar-brand" style="cursor: default;">试卷名:</span>
        <span class="navbar-brand" style="cursor: default;" id="testPaperName">新建试卷</span>
        <span class="navbar-brand" style="cursor: default;">科目:</span>
        <span class="navbar-brand" style="cursor: default;" id="testPaperSubject" tag="0"></span>
        <span class="navbar-brand" style="cursor: default;">试卷总分:</span>
        <span class="navbar-brand totalScore" style="cursor: default;"></span>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav navbar-right">
            <li><a href="javascript:void(0);" data-toggle="modal" data-target="#editTestPaperInfo"
                   onclick="editTestPaperMessage()">编辑试卷信息</a></li>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">添加题目 <b class="caret"></b></a>
                <ul class="dropdown-menu" id="dropdownCategory">
                </ul>
            </li>
            <li style="margin-top: 10px;margin-left: 30px;">
                <button type="button" class="btn btn-warning"
                        onclick="window.location.href = '<%=basePath%>' + 'page/testPaper/testPaper.jsp'">
                    返回
                </button>
            </li>

            <li style="margin:10px 100px 0 10px;">
                <form action="TestPaper!addTestPaper.action" method="post"  onsubmit="return saveTestPaper()">
                    <input type="hidden" name="owner" value="${person.accout}"/>
                    <input type="hidden" name="sumScore" value=""/>
                    <input type="hidden" name="testName" value=""/>
                    <input type="hidden" name="subject" value=""/>
                    <input type="hidden" name="testpaperDesc" value=" "/>
                    <input type="hidden" name="testIds" value=""/>
                    <input type="hidden" name="testScores" value=""/>

                    <button type="submit" class="btn btn-primary">保存试卷</button>
                </form>

            </li>
        </ul>
    </div>
    <!-- /.navbar-collapse -->
</nav>

<!-- Modal -->
<div class="modal fade" id="editTestPaperInfo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" style="width: 700px;height:500px;margin-top: 80px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="editTestPaperInfoLabel">编辑试卷信息</h4>
            </div>
            <div class="modal-body">
                <div class="input-group">
                    <span class="input-group-addon">试卷名称</span>
                    <input type="text" class="form-control" name="editingTestPaperName" id="editingTestPaperName"
                           placeholder="" style="width: 260px;">
                    <span class="input-group-addon">科目</span>
                    <label for="subject"></label><select name="subject" id="subject" class="form-control"
                                                         style="text-align: center;width: 280px;">
                </select>
                </div>
                <div class="input-group">
                    <span class="input-group-addon">试卷描述</span>
                    <script id="editor" type="text/plain" style="width:595px;height:200px;"></script>
                </div>

            </div>
            <div class="modal-footer">

                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="finishTestpaperMessage()"
                        >保存设置
                </button>
            </div>
        </div>
    </div>
</div>
<!-- /.modal -->


<!-- Modal -->
<div class="modal fade" id="testsModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-dialog" style="width: 1200px;height:550px; margin: 10px auto;">
        <div class="modal-content">
<%--            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">题目添加</h4>
            </div>--%>
            <div class="modal-body">
                <%@ include file="/page/testPaper/chooseTest.jsp" %>
            </div>
            <div class="modal-footer" style="margin-top: 0;">
                <div style="float: left">
                    <div class="alert alert-info"
                         style="margin-top: 0;margin-bottom: 0;padding: 5px;width:
                400px;text-align: left;">
                        <div class="input-group" style="padding-left: 20px;">
                            设置选中的试题分数:
                            <input type="text" class="form-control"
                                   onkeyup="this.value=this.value.replace(/[^\d]/g,'') "
                                   onafterpaste="this.value=this.value.replace(/[^\d]/g,'') " id="selectedTestScore"
                                   style="width: 30%;" placeholder="0">&nbsp;分 &nbsp;&nbsp; &nbsp;已选中
                            <span id="selectedTestNum">0</span>题
                        </div>


                    </div>
                </div>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" onclick="addTestToPage()">添加到试卷</button>
            </div>
        </div>
    </div>
</div>
    <!-- Modal -->
    <div class="modal fade" id="editTestScore" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
        <div class="modal-dialog" style="width: 350px;height:400px;margin-top: 150px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title editTestHead" >编辑试题分数</h4>
                </div>
                <div class="modal-body">
                    <div class="input-group">
                        <span class="input-group-addon">分数</span>
                        <input type="text" class="form-control inputTestScore" name="inputTestScore"
                               onkeyup="this.value=this.value.replace(/[^\d]/g,'') "
                               onafterpaste="this.value=this.value.replace(/[^\d]/g,'') "   placeholder="0" style="width: 260px;">

                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="editScoreButton()">保存设置
                    </button>
                </div>
            </div>
        </div>
    </div>
<%--
<div class="alert alert-success">...</div>
<div class="alert alert-info">...</div>
<div class="alert alert-warning">...</div>
<div class="alert alert-danger">...</div>

<span class="label label-default">Default</span>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>


<div class="alert alert-warning alert-dismissable" id="warning-block">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
    <strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>

--%>

<div class="selectTestList" data-spy="scroll"></div>


</div>
</div>
</div>

<div id="footer">
    <p style="text-align: center;color: #757575;padding: 20px 0px 0px 0px; font:12px;">Copyright © 2010-2013 蓝天白云团队
        版权所有</p>
</div>
</body>
</html>
